package com.github.livebase.util;

public class StringKeyValuePairs extends KeyValuePairs<String, String> {

    public static StringKeyValuePairs createKeyValuePairs(String string, String delimiter) {
        int idx = string.indexOf(delimiter);
        if (idx == -1) {
            return new StringKeyValuePairs(string, "");
        }
        return new StringKeyValuePairs(string.substring(0, idx), string.substring(idx + delimiter.length()));
    }

    public StringKeyValuePairs(String key, String value) {
        super(key, value);
    }

    public String join(String delimiter) {
        return this.key + delimiter + this.value;
    }
}
